package com.aliyun.oss.service.impl;

import com.aliyun.oss.mapper.SetMealDishMapper;
import com.aliyun.oss.pojo.DTO.AddSetmealDish;
import com.aliyun.oss.pojo.Entity.setMealDish;
import com.aliyun.oss.service.SetMealDishService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SetMealDishServiceImpl  extends ServiceImpl<SetMealDishMapper, setMealDish> implements SetMealDishService{
    @Override
    public void addSetmealDish(List<AddSetmealDish> addSetmealDishes) {
//        批量插入
        List<setMealDish> setMealDishes = addSetmealDishes.stream().map(addSetmealDish -> new setMealDish(addSetmealDish.getSetmealId(),addSetmealDish.getId(),addSetmealDish.getName(),addSetmealDish.getTotalPrice())).toList();
        this.saveBatch(setMealDishes);
    }
}
